package com.qf.web.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//服务器转发到服务器之间不用加绝对路径
//如果我们用不继承的select来转发select  那么 就相当于是一个方法    以方法的方式来调用Baseservlet让Baseservlet来进行分析，分析后转发
//但是为什么不能用绝对路径呢？
@WebServlet(name = "GoodServlet",value = "/good")
public class GoodServlet extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println(request.getContextPath());

//        request.getRequestDispatcher(request.getContextPath()+"/orderservlet?method=sss").forward(request,response);
        response.sendRedirect(request.getContextPath()+"/orderservlet?method=sss");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
